jq load无效,jQuery .load()不起作用

您所在的位置:网站首页 jquery load js 失效 jq load无效,jQuery .load()不起作用

jq load无效,jQuery .load()不起作用

2023-08-26 06:05| 来源: 网络整理| 查看: 265

On my website, I'm trying to pull the content of a post in my forum (hosted on the same domain) and display it in a div on the homepage, using jQuery.

Here's the code for the header:

jQuery("#contain").load("http://examplepage.com/forum/showthread.php?tid=NN #pid_NN");

Then, there's the div I'd like to display the post:

Things to consider:

The library loads just fine.

If I enter any other code, it works (like testing alert(1);).

The console doesn't report any errors.

The div stays blank; in fact, it doesn't even show. It is there, though.

What am I doing wrong?

解决方案

your code should be something like this

js code

jQuery(document).ready(function(){

jQuery("#contain").load("http://examplepage.com/forum/showthread.php?tid=NN #pid_NN");

});



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3